﻿using System.Windows;
using GalaSoft.MvvmLight;
using GalaSoft.MvvmLight.Command;
using GalaSoft.MvvmLight.Ioc;
using GalaSoft.MvvmLight.Messaging;
using WinAutomator.Library.InOut;

namespace WinAutomator.Plugin
{
    /// <summary>
    /// This class contains properties that a View can data bind to.
    /// <para>
    /// See http://www.galasoft.ch/mvvm
    /// </para>
    /// </summary>
    public class WAConnectorViewModel : ViewModelBase
    {
        public VirtualConnector Model { get; private set; }

        /// <summary>
        /// Initializes a new instance of the WAConnectorViewModel class.
        /// </summary>
        /// 

        [PreferredConstructor]
        public WAConnectorViewModel()
        {
            TestCommandPassParamRC = new RelayCommand(() => TestCommandPassParam2());

        }

        
        public WAConnectorViewModel(VirtualConnector vConn)
        {
            Model = vConn;
            TestCommandPassParamRC = new RelayCommand(() => TestCommandPassParam2());

        }

        public RelayCommand TestCommandPassParamRC
        {
            get;
            private set;
        }

        private void TestCommandPassParam2()
        {
            //Send message to main application
            Messenger.Default.Send(this, "ClickConnector");
        }


        /// <summary>
        /// The <see cref="AnchorPoint" /> property's name.
        /// </summary>
        public const string AnchorPointPropertyName = "AnchorPoint";

        private Point _myAnchorPoint = new Point();

        /// <summary>
        /// Sets and gets the AnchorPoint property.
        /// Changes to that property's value raise the PropertyChanged event. 
        /// </summary>
        public Point AnchorPoint
        {
            get
            {
                return _myAnchorPoint;
            }

            set
            {
                if (_myAnchorPoint == value)
                {
                    return;
                }

                //RaisePropertyChanging(AnchorPointPropertyName);
                _myAnchorPoint = value;
                RaisePropertyChanged(AnchorPointPropertyName);
            }
        }


    }
}